import { ReturnResult } from '@/types/http';
import {
  httpGet,
  httpPost,
  httpDelete,
} from '@/utils/http';

export function getFieldsGoodsServicesList(
  page: number,
  pageSize: number,
  keyword: string
) {
  return httpGet<ReturnResult>({
    url: '/yixiantong-goods-services/list',
    params: {
      page,
      pageSize,
      keyword,
    },
  });
}

export function getFieldsGoodsServicesDetail(id: number | string) {
  return httpGet<ReturnResult>({
    url: `/yixiantong-goods-services/${id}`,
    params: { id },
  });
}

export function createOrUpdateFieldsGoodsServicesItem<T extends object>(data: T) {
  return httpPost<ReturnResult<T>>({
    url: '/yixiantong-goods-services',
    params: { ...data },
  });
}

export function deleteFieldsGoodsServicesItem(id: number | string) {
  return httpDelete<ReturnResult>({
    url: `/yixiantong-goods-services/${id}`,
    params: { id },
  });
}
